<template>
	<view>
		<view  @click="tabCur(0)"> 
			点击1
			
		</view>
		<view  @click="tabCur(1)">
			点击2
			
		</view>
		
		
		<view v-show ="curr == 0" class="s1"></view>
		<view v-show ="curr == 1" class="s2"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				curr:''
				
				
			}
		},
		methods: {
			tabCur(index){
				this.curr = index;
				let info1 = uni.createSelectorQuery().select('.s1')
				let info2 = uni.createSelectorQuery().select('.s2')
				switch(index){
					case 0:
						// (async()=>{
						// 	await info1.boundingClientRect((data)=>{
						// 	console.log('获取第一个的高度',data)
						// }).exec()
						// })()
						
						// setTimeout(()=>{
						// 	info1.boundingClientRect((data)=>{
						// 		console.log('获取第一个的高度',data)
						// 	}).exec()
						// })
						
						
						
						this.$nextTick(() => {
								info1.boundingClientRect((data)=>{
									console.log('获取第一个的高度',data)
								}).exec()
						})
						
						// info1.boundingClientRect((data)=>{
						// 	console.log('获取第一个的高度',data)
						// }).exec()
					break;
					case 1:
						info2.boundingClientRect((data)=>{
							console.log('获取第二个的高度',data)
						}).exec()
						
					break;
				}
				
			}
		}
	}
</script>

<style>

.s1{
	width: 20rpx;
	height: 200rpx;
	background-color: #09BB07;
}
.s2{
	width:20rpx;
	height: 300rpx;
	background-color:#0066CC;
}
</style>
